// 引入 vue
import Vue from 'vue'
// 引入 vue-router 插件
import VueRouter from "vue-router";
// 使用 VueRouter 插件
Vue.use(VueRouter)
//  引入 组件
import layout from '../views/layout.vue'
import detail from '../views/article-detail.vue'
import article from '../views/article.vue'
import collect from '../views/collect.vue'
import like from '../views/like.vue'
import user from '../views/user.vue'


// 创建 路由 对象
const router = new VueRouter({
  // 配置一级路由
  routes: [
    {
      path: '/',
      component: layout,
      // 配置 二级 路由
      children: [
        {
          path: '/article',
          component: article
        },
        {
          path: '/collect',
          component: collect
        },
        {
          path: '/like',
          component: like
        },
        {
          path: '/user',
          component: user
        }
      ]
    },
    {
      path: '/detail/:id',
      component: detail
    }
  ]
})
// 默认导出 当前 router 文件
export default router